<template>
  <BasicDrawer v-bind="$attrs" @register="registerDrawer" showFooter :title="getTitle" width="70%" :show-ok-btn="false"
    :loading="loading">
    <!-- 审批进度 -->
    <div style="width: 100%;">
      <!-- v-on="gridEvents" overflow: hidden -->
      <vxe-grid ref="tableRef" v-bind="gridOptions" :style="{height: (contentHeight*0.86)+'px'}">
        <template #toolbar_buttons>

        </template>

      </vxe-grid>
    </div>

  </BasicDrawer>
</template>
<script lang="ts" setup>
import { ref, computed, unref, h, toRaw, reactive } from 'vue';

import {
  BasicTableProps,
  VxeGridInstance, VxeTableDefines
} from '@/components/VxeTable';
import {
  passFormSchema,
   passTableColumns
} from './role.data';
import {
  checkboxCountFn
} from '../../dknMoneyList/role.data';
import { rules } from './role.data';
import { BasicDrawer, useDrawerInner } from '@/components/Drawer';

import { BasicTree, TreeItem } from '@/components/Tree';
import { tablePassAffirmList } from '@/api/heng/ywManage';
import { BasicTable, useTable, TableAction, ActionItem } from '@/components/Table';

import { Modal, Timeline, TimelineItem } from 'ant-design-vue';

import { useMessage } from "@/hooks/web/useMessage";
import util from '@/utils/util';
import { t } from '@/hooks/web/useI18n';

const emit = defineEmits(['success', 'register']);
const isUpdate = ref(true);
const treeData = ref<TreeItem[]>([]);
const { createMessage } = useMessage();
const mouldMainId = ref("");

const applyViewShow = ref(false);
const visible = ref(false);
const msgList = ref([]);

const tableRef = ref<VxeGridInstance>();
const contentHeight = ref(window.innerHeight);

const gridOptions = reactive<BasicTableProps>({
  // keepSource: true,
  border: true,
  showOverflow: true,
  size: 'mini',
  height: 'auto', // 'auto'
  columns: passTableColumns,
  filterConfig: {
    remote: true,
  },
  exportConfig: {},

  // showFooter: true,
  // footerData: [
  //   { orderNo: '合计' }
  // ],
  formConfig:{
    items:passFormSchema
  },
  toolbarConfig: {
    slots: {
      buttons: 'toolbar_buttons',
    },
    refresh: true,
  },

  pagerConfig: {
    autoHidden:false,

  },
  proxyConfig: {
    props: {
      result: 'data.list',
      list: 'data.list',
      total: 'data.totalResult',
      message: 'message',
    },
    filter: true,
    ajax: {
      query: ({ page, form, filters }) => {
        return findPageList(page, form, filters);
      },
    },
  },
});
function findPageList(page, form, filterList?: VxeTableDefines.FilterCheckedParams<any>[]) {
  let json = {};
  if (filterList && filterList.length) {
    filterList.forEach((e) => {
      const value = e.datas[0];
      let field = e.field;
      json[field + 'Like'] = value;
    });
  }
  // console.log("----json:", json);
  // ywApproveList xftList
  return tablePassAffirmList({
    page: page.currentPage,
    pageSize: page.pageSize,
    ...form,
    ...json,
  });
}

const startNodeList = ref([]);
const loading = ref(false);
const loading2 = ref(false);

const dataList = ref({});

const totalObj = ref({});

const dataJson = ref({});//审批发起后 返回的数据
const types = ref("");
const [registerDrawer, { setDrawerProps, closeDrawer }] = useDrawerInner(async (data) => {
  //打开弹层后的回调
  // resetFields();
  setDrawerProps({ confirmLoading: false });

  dataList.value = [];

  tableRef.value.commitProxy('reload');

});

const getTitle = computed(() => ('查看已抽成收款编号'));


//async function handleSubmit()


function sunccFn(result) {
  if (result && result.code == 200) {
    createMessage.success(result.message);
    closeDrawer()
    emit('success');
  } else {
    createMessage.error(result.message);
  }

}


</script>
<style lang="less">
.item-row {
  margin: 0 auto;

  //padding-left: 5%;
  .ant-form-item-label {
    flex: 0 0 28.5%;
    max-width: 28.5%;
  }
}

.lqfp-8 {
  //padding-left: 9% !important;

}
</style>
